package day06;

public class MethodDemo {
    public static void main(String[] args) {
        int[] arr = testArray();
        System.out.println(arr.length);
        for (int i =0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        say();
        MethodDemo.say();
        sayHi("古天乐");
        sayHello("渣渣灰",18);
        double a =getNum();
        System.out.println(a);
        int b =plus(5,6);
        System.out.println(b);
        int x = 1,y = 11;
        int z = plus(x,y);
        System.out.println(z);
    }
    public static void sayHi(String name){
        System.out.println("大家好，我系"+name);
    }
    public static void say(){
        System.out.println("大家好，我系渣渣辉");
    }
    public static void sayHello(String name,int age){
        System.out.println("大家好，我系"+name+",今年"+age+"岁了");
    }
    public static double getNum(){
        //若方法有返回值，则在方法中必须出现return关键字
        //并且return后的数据类型必须与返回值类型匹配
        return 13;
    }
    public static int plus(int num1,int num2){
        int num=num1+num2;
        return num;
    }
    public static int[] testArray(){
        int[] arr = new int[10];
        for (int i = 0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
        }
        return arr;
    }

}
